package com.coder.books.thinkinjava.containers;

import com.coder.util.CountingMapData;

import java.util.LinkedHashMap;

import static com.coder.util.Print.println;

/**
 *
 * @author yuhushuan
 * @date 2020/8/17 13:53
 */
public class LinkedHashMapDemo {
    public static void main(String[] args) {
        LinkedHashMap<Integer, String> linkedHashMap =
                new LinkedHashMap<>(new CountingMapData(9));
        println(linkedHashMap);

        // 最近最少使用 排序
        linkedHashMap = new LinkedHashMap<>(16, 0.75f, true);
        linkedHashMap.putAll(new CountingMapData(9));

        println(linkedHashMap);

        for (int i = 0; i < 6; i++) {
            linkedHashMap.get(i);
        }
        println(linkedHashMap);
        linkedHashMap.get(0);
        println(linkedHashMap);

    }
}
